#include "Blocks/MusketBlock.h"

namespace PocketSurvival
{

    int32_t MusketBlock::getDamage(int32_t value)
    {
        return (Terrain::ExtractData(value) >> 8) & 0xFF;
    }
    int32_t MusketBlock::setDamage(int32_t value, int32_t damage)
    {
		int32_t num = Terrain::ExtractData(value);
		num &= -65281;
		num |= MathUtils::Clamp(damage, 0, 255) << 8;
		return Terrain::ReplaceData(value, num);
    }

    int32_t MusketBlock::getIndex()
    {
        return Index();
    }
    const std::string &MusketBlock::getBlockName()
    {
        static std::string blockName = "MusketBlock";
        return blockName;
    }
}